package com.gzwanchuang.lszg.adapter;


import android.content.Context;
import android.graphics.Color;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gzwanchuang.lszg.R;
import com.gzwanchuang.lszg.proto.Mystock;

import java.util.List;

public class AllocMachineAdapter extends BaseQuickAdapter<Mystock.myMachineType.goodsInfo, BaseViewHolder> {
    public AllocMachineAdapter(Context context, List<Mystock.myMachineType.goodsInfo> dataList) {
        super(R.layout.item_alloca_machine, dataList);
    }

    @Override
    protected void convert(BaseViewHolder helper, Mystock.myMachineType.goodsInfo item) {
        helper.setText(R.id.tv_name, item.getGoodsName());
        if (item.getIsPolicy().equals("1") && item.getIsPolicyOther().equals("1") && item.getIsStock().equals("1")) {
            helper.setVisible(R.id.tv_no_use, false)
                    .setVisible(R.id.iv_next, false)
                    .setTextColor(R.id.tv_name, Color.parseColor("#FF5C1E1E"));
        } else if (item.getIsPolicy().equals("0")) {
            helper.setVisible(R.id.tv_no_use, true)
                    .setVisible(R.id.iv_next, false)
                    .setTextColor(R.id.tv_name, Color.parseColor("#FFDFC2A9"))
                    .setText(R.id.tv_no_use, "(该机型无政策)");
        } else if (item.getIsPolicyOther().equals("0")) {
            helper.setVisible(R.id.tv_no_use, true)
                    .setVisible(R.id.iv_next, false)
                    .setTextColor(R.id.tv_name, Color.parseColor("#FFDFC2A9"))
                    .setText(R.id.tv_no_use, "(TA该机型无政策)");
        } else if (item.getIsStock().equals("0")) {
            helper.setVisible(R.id.tv_no_use, true)
                    .setVisible(R.id.iv_next, false)
                    .setTextColor(R.id.tv_name, Color.parseColor("#FFDFC2A9"))
                    .setText(R.id.tv_no_use, "(该机型无库存)");
        }


    }
}